package com.eleventwelve.iris.web.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.eleventwelve.iris.entity.Treatment;

/**
 * 
 * @author Ashley
 *
 */
public class TreatmentValidator implements Validator{

	@Override
	public boolean supports(Class<?> arg0) {
		return Treatment.class.isAssignableFrom(arg0);
	}

	@Override
	public void validate(Object obj, Errors err) {
		ValidationUtils.rejectIfEmptyOrWhitespace(err, "procedure", "error.required-field", new Object[] { "Procedure" });
		ValidationUtils.rejectIfEmptyOrWhitespace(err, "performedBy", "error.required-field", new Object[] { "Staff" });
	}

}
